package com.suixun.service.mongodb;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import com.suixun.dao.mongodb.SplashMediaDao;
import com.suixun.entity.mongodb.SplashMedia;
import com.suixun.util.db.MongoDBPagination;

@Service("splashMediaService")
public class SplashMediaService {

    @Resource
    private SplashMediaDao splashMediaDao;

    public SplashMedia findByid(int id) {
        return splashMediaDao.findById(id);
    }

    public SplashMedia findOne(Map<String, String> params) {
        return this.splashMediaDao.findOne(params);
    }

    public List<SplashMedia> find(Query query) {
        return this.splashMediaDao.find(query);
    }

    public SplashMedia save(SplashMedia bean) {
        return splashMediaDao.save(bean);
    }

    public MongoDBPagination<SplashMedia> getPageArticle(int pageNo, int pageSize) {
        return splashMediaDao.getPageArticle(pageNo, pageSize);
    }

    /**
     * 暂时只是固定去修改,会有下一篇博客,写高级修改...
     */
    public void update(String id, Map<String, String> params) {
        this.splashMediaDao.updateEntity(id, params);
    }

    public SplashMedia findAndRemove(Query query) {
        return this.splashMediaDao.findAndRemove(query);
    }

    public SplashMedia findAndModify(Query query, Update update) {

        return this.splashMediaDao.findAndModify(query, update);
    }
}
